#!/bin/sh

# wake those detached processes up to do read
kill -USR1 $(cat $TMP/pidfile)

any_pid_alive()
{
        local pidfile=$1
        for pid in $(cat $pidfile)
        do
                test -d /proc/$pid && return
        done
        return 1
}

# wait till those detached processes exit
while true
do
        sleep 5
        any_pid_alive $TMP/pidfile && continue
        break
done

rm $TMP/pidfile

# lkp will complain if the test doesn't generate any output
echo "test done"
